home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / lib / memset.c < prev    next >
C/C++ Source or Header  |  1991-11-27  |  2KB  |  58 lines

  1. /*  $Revision: 1.2 $
  2. **
  3. **  This file has been modified to get it to compile more easily
  4. **  on pre-4.4BSD systems.  Rich $alz, June 1991.
  5. */
  6. #define const /* NULL */
  7. #define void char
  8. #define size_t int
  9. #define NULL 0
  10.  
  11. /*-
  12.  * Copyright (c) 1990 The Regents of the University of California.
  13.  * All rights reserved.
  14.  *
  15.  * This code is derived from software contributed to Berkeley by
  16.  * Chris Torek.
  17.  *
  18.  * Redistribution and use in source and binary forms are permitted
  19.  * provided that: (1) source distributions retain this entire copyright
  20.  * notice and comment, and (2) distributions including binaries display
  21.  * the following acknowledgement:  ``This product includes software
  22.  * developed by the University of California, Berkeley and its contributors''
  23.  * in the documentation or other materials provided with the distribution
  24.  * and in all advertising materials mentioning features or use of this
  25.  * software. Neither the name of the University nor the names of its
  26.  * contributors may be used to endorse or promote products derived
  27.  * from this software without specific prior written permission.
  28.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  29.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  30.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  31.  */
  32.  
  33. #if 0
  34. #if defined(LIBC_SCCS) && !defined(lint)
  35. static char sccsid[] = "@(#)memset.c    5.5 (Berkeley) 5/15/90";
  36. #endif /* LIBC_SCCS and not lint */
  37.  
  38. #include <string.h>
  39. #include <sys/stdc.h>
  40. #endif
  41.  
  42. void *
  43. memset(dst, c, n)
  44.     void *dst;
  45.     register int c;
  46.     register size_t n;
  47. {
  48.  
  49.     if (n != 0) {
  50.         register char *d = dst;
  51.  
  52.         do
  53.             *d++ = c;
  54.         while (--n != 0);
  55.     }
  56.     return (dst);
  57. }
  58.